-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NullHtmlLocalizer for Core5 #7532
Conversation
@@ -56,7 +56,8 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures) | |||
public LocalizedString GetString(string name, params object[] arguments) => | |||
NullStringLocalizerFactory.NullLocalizer.Instance.GetString(name, arguments); | |||
|
|||
IHtmlLocalizer IHtmlLocalizer.WithCulture(CultureInfo culture) => Instance; | |||
[Obsolete("This method will be removed in the upcoming ASP.NET Core major release.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need while the Localization APIs already warn about this. Second thing I'm not sure how this fix related to the referred issue, @agriffard is already fixed most if not issues in the PR #6999
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pr is not about moving to .Net Core 5 @hishamco - If you read the comments on the pr, it is about enabling usage of OrchardCore nugets in a solution targeting .Net Core 5.
@agriffard pr is about actually moving the target framework to .Net Core 5, which is a different thing.
I put the Obsolete
in, although not required, so that when we move to .Net Core 5, we will catch it to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pr is not about moving to .Net Core 5
Ya, but I'm not sure what's the issue if we didn't add this attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's going to warn those using it that they should stop using this method because it could be eventually removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm expected ASP.NET Core localization APIs will going to warn insted
I don't think the C# version matters at all. And we can't use C# 9 if we don't use the dotnet 5 sdk which is not public yet. |
A comment about the possible issues around multi targeting only. This pr is purely about getting the ability to run the current Orchard Core nugets, inside a webapp targeting the dotnet 5 pre release framework |
C# version is independent from dotnet version, when you multi target it's with dotnet versions. Once an assembly is built, the language version doesn't matter anymore. |
Note that we can remove |
Fixes #7530
This just makes the interface for
WithCulture
which is obsolete on theIHtmlLocalizer
interface explicit rather than implicit.This means you can use a ASP.NET Core 3 nuget pack of OrchardCore in a .Net 5 application safely.
Packed locally and tested, works fine.
@sebastienros I know we talked about using some compiler directives, but at this point they're not necessary, unless we at some point do a multi target version.
I'm not sure we should - or if we do, we might want to keep the lang version to C# 8 so we don't have to many compiler directives to worry about.
We might put the compiler directives around this to prevent compiler warnings (I think this will actually still compile fine, but there might be a build analyser warning) for people using the source code, and moving the entire OrchardCore solution to .Net 5, but for a separate pr, if we decide we should support that